import dayjs from 'dayjs'
// 插件
import relativeTime from 'dayjs/plugin/relativeTime'
// 中文包
import 'dayjs/locale/zh-cn'
dayjs.locale('zh-cn')

// 时间处理
export const toTimeAgo = (targetTime) => {
  dayjs.extend(relativeTime)
  const a = dayjs()
  const b = dayjs(targetTime)
  // console.log(a.to(b))
  return a.to(b)
}
